#ifndef __LOGIN_DEVICE_H__
#define __LOGIN_DEVICE_H__

#define USER_ID_SIZE        (8)
#define USER_PASSWD_SIZE    (8)
#define ADMIN_ID_SIZE       (2)
#define ADMIN_PASSWD_SIZE   (2)
#define NAME_SIZE           (20)
#define CITIZEN_ID_SIZE     (8)
#define PHONE_NUM_SIZE      (11)

struct user {
    char user_id[USER_PASSWD_SIZE];
    char passwd[USER_PASSWD_SIZE];
    char name[NAME_SIZE];
    char citizen_id[CITIZEN_ID_SIZE];
    char phone_num[PHONE_NUM_SIZE];
    struct list_head list;
};

struct admin {
    char admin_id[ADMIN_ID_SIZE];
    char passwd[ADMIN_PASSWD_SIZE];
};

extern int match_user_info(char *user_id, char *passwd,
                            struct list_head *user_head,
                            struct user *current_user);
extern int is_user_info_repeat(char *user_id, char *citizen_id,
                        char *phone_num, struct list_head *user_head);
extern void admin_init(struct admin *admin);
extern int user_init(struct list_head *user_head);
extern int user_destroy(struct list_head *user_head);
extern void admin_destroy(struct admin *admin);

#endif